/**
 * 商品相关的ajax函数
*/
import axios from "@/utils/request";

//获取商品分类列表
export const getGoodsCate= (params) =>{
    
    return axios({
        url:'/goods/catelist',
        method:'get',
        params
    })
}

//添加商品
export const goodsAdd= (data) =>{
    
    return axios({
        url:'/goods/add',
        method:'post',
        data
    })
}


//修改商品分类列表
export const UpdateGoodsCate= (data) =>{
    
    return axios({
        url:'/goods/editcate',
        method:'POST',
        data
    })
}



//修改商品分类名称
export const UpdateGoodsCategories= (params) =>{
    
    return axios({
        url:'/goods/categories',
        method:'get',
        params
    })
}

// 删除分类
export const delGoodsCategories= (params) =>{
    
    return axios({
        url:'/goods/delcate',
        method:'get',
        params
    })
}






//17. 商品图片上传接口

export const addGoodsImg= (data) =>{
    
    return axios({
        url:'/goods/goods_img_upload',
        method:'post',
        data
    })
}



//19. 获取商品列表
export const getGoodsList= (params) =>{
    
    return axios({
        url:'/goods/list',
        method:'get',
        params
    })
}

//17. 商品图片上传接口
export const getGoodsImg= (data) =>{
    
    return axios({
        url:'/goods/goods_img_upload',
        method:'post',
        data
    })
}


// 12. 添加商品分类
export const goodsAddcate= data =>{
    
    return axios({
        url:'/goods/addcate',
        method:'POST',
        data
    })
}


//21. 修改商品
export const goodEdit= (data) =>{
    
    return axios({
        url:'/goods/edit',
        method:'post',
        data
    })
}

//16. 查询所有启用的分类名称
export const categories= (params) =>{
    
    return axios({
        url:'/goods/categories',
        method:'get',
        params
    })
}


//20. 删除商品查询所有启用的分类名称
export const goodsDel= (params) =>{
    
    return axios({
        url:'/goods/del',
        method:'get',
        params
    })
}
